<template>
	<view class="scrool-page">
		<view class="list-cont">
			<scroll-view  class="scrool-more" style="height: 100%" scroll-y="true" scroll-with-animation="true">
				<view v-for="(item,index) in productList" :key="item.recptId">
					<view v-for="(child,sn) in item.childList" :key="child.lineLd">
						<uni-card :title="'序号:'+(sn+1)" v-if="child.areaCode != null && child.areaCode != '' &&  child.areaCode!='R' " style='background-color: darkgrey;'>
							<text class="uni-body">物料编码：{{ child.itemCode }}</text><br> 
							<text class="uni-body">数量：{{ child.quantityReserved }}</text><br>
							<text class="uni-body">箱号：{{ child.attr10 }}</text><br>
							<!-- <text class="uni-body">推荐库位：{{ child.attr1 }}</text><br> -->
							<text class="uni-body">库位：{{ child.areaCode }}</text><br>
							<text class="uni-body" v-if="child.areaCode == 'CH'">已越库</text><br>
						</uni-card>
						
						<uni-card :title="'序号:'+(sn+1)" v-else>
							<text class="uni-body">物料编码：{{ child.itemCode }}</text><br> 
							<text class="uni-body">数量：{{ child.quantityReserved }}</text><br>
							<text class="uni-body">箱号：{{ child.attr10 }}</text><br>
							<!-- <text class="uni-body">推荐库位：{{ child.attr1 }}</text><br> -->
							<text class="uni-body">库位：{{ child.areaCode }}</text><br>
						</uni-card>
					</view>					
				</view>
			</scroll-view>
		</view>
		
		<view class="footer">
			<button type="default" size='mini' @click="reduceData" style="width:48%; margin-left:1%;" v-if="!userflag">减箱</button>
			<button type="default" size='mini' @click="reduceData" style="width:48%; margin-left:1%;" v-else>加箱</button>
			<button type="default" size='mini' @click="submit" style="width:48%; margin-left:1%;" :disabled="isShow">完成</button>
		</view>
		
		<!-- <uni-popup ref="alertDialog" type="dialog" :is-mask-click="false">
			<uni-popup-dialog type="success" cancelText="关闭" confirmText="确定" title="提示" :before-close="true" :content="content" @confirm="dialogConfirm"
				@close="dialogClose" >
			</uni-popup-dialog>
		</uni-popup> -->
		
		<uni-popup ref="messageDialog" type="dialog" :is-mask-click="false">
			<uni-popup-dialog type="success" cancelText="关闭" confirmText="确定" title="提示" :before-close="true" :content="messageContent" @confirm="messageConfirm"
				@close="messageClose" >
			</uni-popup-dialog>
		</uni-popup>
		<!-- 若该库位不是该箱的推荐库位，则给予提示 -->
		<uni-popup ref="tipDialog" type="dialog" :is-mask-click="false">
			<uni-popup-dialog type="success" cancelText="关闭" confirmText="确定" title="提示" :before-close="true" :content="tipContent" @confirm="tipConfirm"
				@close="tipClose" >
			</uni-popup-dialog>
		</uni-popup>
		
		<uni-popup ref="commonDialog" type="dialog" :is-mask-click="false">
			<uni-popup-dialog type="success" cancelText="关闭" confirmText="确定" title="提示" :before-close="true" :content="commonContent" @confirm="commonConfirm"
				@close="commonClose">
			</uni-popup-dialog>
		</uni-popup>
	</view>
</template>

<script>
	import Vue from 'vue'
	import { getToken } from '@/utils/auth'
	import common from '../../pages/common/common.js'
	var main, receiver, filter;
	var ScanDeviceClass = plus.android.importClass("android.device.ScanDevice");
	var scanDevice;
	//var mainVoice,RingtoneManager, uri,MediaPlayer,player;	
	export default {
		data() {
			return {
				pkOrder : '',
				productList:[],
				content:'',
				trojanCode:'',
				warehouseLocation:'',
				status:'',
				baseUrl:getApp().globalData.config.baseUrl,
				userName:this.$store.state.user.name,
				title:'产成品入库上架单',
				id:'',
				orgId:getApp().globalData.config.orgId,
				allflag:false,
				messageContent:'',
				boxCode:'',
				url:'',
				areaCode:'',
				tipContent:'',
				index:'',
				userflag:false,
				commonContent:'',
				sum:0,
				totalSum:0,
				isShow:false
			}
		},
		
		onLoad: function (option) { //option为object类型，会序列化上个页面传递的参数
			this.orgId = uni.getStorageSync('orgId');
			this.pkOrder = option.pkOrder;
			this.status = option.status;
			this.title = option.title;
			this.id = option.id;
			this.index = option.index;
			uni.setNavigationBarTitle({
				title:this.title
			});
			var url = '';
			if(this.title.includes('杂收')){
				url = this.baseUrl + "/system/recpt/rcvtrans";
			}else if(this.title.includes('调入')){
				url = this.baseUrl + "/system/recpt/transferIn";
			} else if(this.title.includes('产成品入库')){
				url = this.baseUrl + "/system/recpt/recptId";
			}	
			this.url = url;
			
		},
		
		mounted() {
			this.orgId = uni.getStorageSync('orgId');
			this.queryData(this.pkOrder,this.url);	
		},
		
		// created: function() {
		// 	this.orgId = uni.getStorageSync('orgId');
		// 	this.queryData(this.pkOrder,this.url);	
		// },
		
		onShow() {
			scanDevice = new ScanDeviceClass();
			scanDevice.openScan(); // 打开扫描
			scanDevice.setOutScanMode(0); // 扫描模式				
			this.initScan();
			this.registerScan();
		},
		
		onHide: function() {
			this.unregisterScan();
		},
		
		destroyed: function() {
			this.unregisterScan();
		},
		
		//返回上一页
		onBackPress(options) {
			if (options.from === 'navigateBack') {
			     return false;
			}
			let pages = getCurrentPages();  //获取所有页面栈实例列表
			let nowPage = pages[ pages.length - 1];  //当前页页面实例
			let prevPage = pages[ pages.length - 2 ];  //上一页页面实例
			prevPage.$vm.chooseTab(this.index);	
			uni.navigateBack({  //uni.navigateTo跳转的返回，默认1为返回上一级
			    delta: 1
			});
			return true;
		},
		
		methods: {
			initScan(popFlag) {
				let _this = this;
				main = plus.android.runtimeMainActivity(); //获取activity  
				var IntentFilter = plus.android.importClass('android.content.IntentFilter');
				filter = new IntentFilter();
				filter.addAction("scan.rcv.message"); // 换你的广播动作  
				receiver = plus.android.implements('io.dcloud.feature.internal.reflect.BroadcastReceiver', {
					onReceive: function(context, intent) {
						plus.android.importClass(intent);
						let code = intent.getByteArrayExtra('barocode');
					    let codeStr = common.utf8ByteToUnicodeStr(code);
						_this.buttonScanNew(codeStr);
						_this.viewScan(codeStr);				
						scanDevice.stopScan(); // 停止扫描						
					}
				});				
			},
			
			registerScan() {
				main.registerReceiver(receiver, filter);
			},
			
			unregisterScan() {
				main.unregisterReceiver(receiver);
			},
			
			queryData(recptId,url){
				//显示加载框
				uni.showLoading({
				    title: '加载中',
					mask:true
				});
				uni.request({
					//url:this.baseUrl+'/system/recpt/recptId',
					url:url,
					data:{
						recptId : recptId,
						orgId:this.orgId,
						userName:this.userName,
					},
					method: 'POST',
					header:{
						'authorization':  getToken()
					},
					dataType:'json',
					success: (res) =>{
						if(res.data.code == '200' || res.data.code == 200) {
							this.productList = res.data.data;
							this.totalSum = this.productList[0].childList.length;
							this.countSum();
							//隐藏加载框
							uni.hideLoading();
						}else{
							var message = res.data.msg;
							if(message == null || message == '' ){
								message = '操作失败';
							}
							//隐藏加载框
							uni.hideLoading();
							this.commonContent = message;
							this.$refs.commonDialog.open();
							return;
						}
						
					},							
				})
			},
			
			countSum(){
				this.sum = 0;
				var childrenList = this.productList[0].childList;
				for(var i=0;i<childrenList.length;i++){
					var data = childrenList[i];
					if(data.areaCode != null && data.areaCode != '' && data.areaCode != 'R'){
						this.sum ++;
					}
				}
				if(this.warehouseLocation == null || this.warehouseLocation == ''){
					uni.setNavigationBarTitle({
						title:'产成品上架单('+this.sum+'/'+this.totalSum+')'
					});
				}else{
					uni.setNavigationBarTitle({
						title:'产成品上架单('+this.warehouseLocation+")" + this.sum + "/" + this.totalSum
					});
				}								
			},
			
			reduceData(){
				if(this.status =='2'){
					this.commonContent = '任务已挂起，请先恢复';
					this.$refs.commonDialog.open();
					return;
				}
				
				if(this.status =='3'){
					this.commonContent = '任务已完成，不能修改';
					this.$refs.commonDialog.open();
					return;
				}
				if(this.userflag){
					this.userflag = false;
				}else{
					this.userflag = true;
				}
			},
			
			viewScan(codeStr){
				if(!this.userflag){
					return;
				}
				var that = this;
				//显示加载框
				uni.showLoading({
				    title: '加载中',
					mask:true
				});
				var result = common.judgeBarCode(codeStr);
				if(result[0] != "C"){
					uni.hideLoading();	
					that.commonContent = "请扫描箱号";
					that.$refs.commonDialog.open();
				}else{
					uni.hideLoading();
					var flag = false;
					var data = '';
					for(var i=0;i<that.productList[0].childList.length;i++){
						if(result[1] == that.productList[0].childList[i].attr10){
							data = that.productList[0].childList[i];
							flag = true;
							break;
						}
					}
					if(flag){
						uni.request({
							url:that.baseUrl+'/system/area/editPut',
							data:{
								boxCode:result[1],
								lineId : data.lineId,
								areaCode : "",
								userName:that.userName,
								orgId:that.orgId,
								receiptNot:"WmProductRecpt"
							},
							method: 'POST',
							header:{
								'authorization':  getToken()
							},
							dataType:'json',
							success: (res) =>{
								//隐藏加载框
								uni.hideLoading();
								if(res.data.code == '200' || res.data.code == 200) {	
									data.areaCode = "";
									that.queryData(that.pkOrder,that.url);									
									//that.countSum();
									that.prompt();
								}else{
									var title = res.data.msg;
									if(res.data.msg == null || res.data.msg == ''){
										title = '操作失败';
									} 
									that.commonContent = title;
									that.$refs.commonDialog.open();
									return;
								}
								
							},							
						})
					}else{
						uni.hideLoading();
						that.commonContent = '此箱号不存在';
						that.$refs.commonDialog.open();
						return;
					}
					uni.hideLoading();
					that.userflag = false;
				}				
			},
			
			buttonScanNew(codeStr){
				if(this.userflag){
					return;
				}
				var that = this;
				if(that.status =='2'){
					that.commonContent = '任务已挂起，请先恢复';
					that.$refs.commonDialog.open();
					return;
				}
				
				if(that.status =='3'){
					that.commonContent = '任务已完成，不能修改';
					that.$refs.commonDialog.open();
					return;
				}
				if(codeStr == null || codeStr == ''){
					that.commonContent = '请扫描数据';
					that.$refs.commonDialog.open();
					return;
				}
				var result = common.scanCode(codeStr);
				if(result[0] == 'K'){
					//显示加载框
					uni.showLoading({
					    title: '加载中',
						mask:true
					});
					that.warehouseLocation = result[1];					
					that.resYes(result[1]);
					//this.messageContent = '箱号：' +this.boxCode+"\n"+"库位："+this.warehouseLocation+"\n";
				}else if(result[0] == 'C'){
					that.boxCode = result[1];
					var flag = 0;
					for(var i=0;i<that.productList.length;i++){
						var childList = that.productList[i].childList;
						for(var j=0;j<childList.length;j++){
							var data = childList[j];
							if(data.attr10 == result[1]){	
								if(data.areaCode != null && data.areaCode != '' && data.areaCode != 'R'){
									if(data.areaCode == that.warehouseLocation){
										flag = 1;
									}else{
										flag = 2;
									}
									
								}else{
									flag = 3;
								}
								
							}
						}
					}
					if(flag == 0){
						uni.hideLoading();
						that.commonContent = '箱号为'+result[1]+"不存在";
						that.$refs.commonDialog.open();
						return;
					} else if(flag == 1){
						uni.hideLoading();
						that.commonContent = '箱号为'+result[1]+"已上架";
						that.$refs.commonDialog.open();
						return;
					}else if(flag == 2){
						uni.hideLoading();
						that.commonContent = '箱号为'+result[1]+"已上架，是否重新上架？";
						that.$refs.commonDialog.open();
					}else{
						that.messageConfirm();
					}
				}else{
					that.commonContent = '请扫描箱号或者库位';
					that.$refs.commonDialog.open();
					return;
				}				
			},
			
			resYes(warehouseLocation){
				uni.request({
					url:this.baseUrl+'/system/area/ResYes',
					data:{
						areaCode : warehouseLocation,
						userName:this.userName,
						orgId:this.orgId,
					},
					method: 'POST',
					header:{
						'authorization':  getToken()
					},
					dataType:'json',
					success: (res) =>{
						console.log(res);
						//隐藏加载框
						uni.hideLoading();
						if(res.data) {	
							uni.setNavigationBarTitle({
								title:'产成品上架单('+this.warehouseLocation+")" + this.sum + "/" + this.totalSum
							});
						}else{
							this.commonContent = warehouseLocation+'不存在或者不可用';
							this.$refs.commonDialog.open();
							return;
						}
						
					},							
				})
			},
			
			queyArea(codeStr){
				//显示加载框
				uni.showLoading({
				    title: '加载中',
					mask:true
				});
				uni.request({
					url:this.baseUrl+'/system/pdtrcline/postArea',
					data:{
						boxCode:codeStr,	
						orgId:this.orgId
					},
					method: 'POST',
					header:{
						'authorization':  getToken()
					},
					dataType:'json',
					success: (res) =>{
						//隐藏加载框
						uni.hideLoading();
						if(res.data.code == '200' || res.data.code == 200) {	
							this.warehouseLocation = res.data.msg;
							this.areaCode = res.data.msg;
							this.messageContent = '箱号：' +this.boxCode+"\n"+"库位："+this.warehouseLocation+"\n";
						}else{
							var message = res.data.msg;
							if(message == null || message == ""){
								message = "操作失败";
							}
							this.commonContent = message;
							this.$refs.commonDialog.open();
							return;
						}
						
					}		
				})
			},
			
			putOnAll(){
				this.$refs.alertDialog.open();
			},
			
			submit(){
				//显示加载框
				uni.showLoading({
				    title: '加载中',
					mask:true
				});
				if(this.status =='2'){
					//隐藏加载框
					uni.hideLoading();
					this.commonContent = '任务已挂起，请先恢复';
					this.$refs.commonDialog.open();
					return;
				}
				
				if(this.status =='3'){
					//隐藏加载框
					uni.hideLoading();
					this.commonContent = '任务已完成，不能修改';
					this.$refs.commonDialog.open();
					return;
				}
				for(var i=0;i<this.productList.length;i++){
					var childList = this.productList[i].childList;
					for(var j=0;j<childList.length;j++){
						var data = childList[j];
						if(data.areaCode == null || data.areaCode == "" || data.areaCode == "R"){
							//隐藏加载框
							uni.hideLoading();
							this.commonContent = '箱号为'+data.attr10+"未上架";
							this.$refs.commonDialog.open();
							return;
						}
					}
				}
				this.editDetialNew();
			},
			
			messageConfirm(){
				var that = this;
				if(that.boxCode == null || that.boxCode == ''){
					that.commonContent = '请扫描箱号';
					that.$refs.commonDialog.open();
					return;
				}
				if(that.warehouseLocation == null || that.warehouseLocation == ''){
					that.commonContent = '请扫描库位';
					that.$refs.commonDialog.open();
					return;
				}	
				//显示加载框
				uni.showLoading({
					title: '加载中',
					mask:true
				});
				var lineId = "";
				for(var i=0;i<that.productList.length;i++){
					var childList = that.productList[i].childList;
					for(var j=0;j<childList.length;j++){
						var data = childList[j];
						if(data.attr10  ==  that.boxCode){
							if(data.areaCode == 'CH'){
								that.commonContent = '此箱已越库';
								that.$refs.commonDialog.open();
								return;
							}else{
								lineId = data.lineId;
								//推荐库位
								that.areaCode = data.attr1;
								break;
							}							
						}
					}
				}
				var receiptNot = "";
				if(that.title.includes("产成品入库")){
					receiptNot = "WmProductRecpt";
				}else if(that.title.includes("杂收")){
					receiptNot = "WmMiscRcvTrans";
				}else if(that.title.includes("调入")){
					receiptNot = "WmTransferIn";
				}else if(that.title.includes("返工")){
					receiptNot = "rework";
				}
				uni.request({
					url:that.baseUrl+'/system/area/editPut',
					data:{
						boxCode:that.boxCode,
						lineId : lineId,
						areaCode : that.warehouseLocation,
						userName:that.userName,
						orgId:that.orgId,
						receiptNot:receiptNot
					},
					method: 'POST',
					header:{
						'authorization':  getToken()
					},
					dataType:'json',
					success: (res) =>{
						//隐藏加载框
						uni.hideLoading();
						if(res.data.code == '200' || res.data.code == 200) {								
							//that.$refs.messageDialog.close();
							that.boxCode = '';
							that.queryData(that.pkOrder,that.url);							
							//that.countSum();
							that.prompt();
							//this.warehouseLocation = '';
						}else{
							var title = res.data.msg;
							if(res.data.msg == null || res.data.msg == ''){
								title = '操作失败';
							} 
							that.commonContent = title;
							that.$refs.commonDialog.open();
							return;
						}
						
					},							
				})
				// if(that.areaCode != that.warehouseLocation){
				// 	//隐藏加载框
				// 	uni.hideLoading();
				// 	if(that.areaCode != null && that.areaCode != ""){
				// 		that.tipContent = '实际库位'+that.warehouseLocation+'与推荐库位'+that.areaCode + '不一致，是否继续？';
				// 		that.$refs.tipDialog.open();
				// 	}					
				// }else{					
					
				// }												
			},
			
			dialogConfirm(){
				var that = this;
				uni.request({
					url:that.baseUrl+'/system/barcode/boxcode',
					data:{
						storageArea	: that.warehouseLocation,
						barcodeContent:that.trojanCode			
					},
					method: 'POST',
					header:{
						'authorization':  getToken()
					},
					dataType:'json',
					success: (res) =>{
						if(res.data.code == '200' || res.data.code == 200) {									
							that.$refs.alertDialog.close();
						}else{
							var title = res.data.msg;
							if(res.data.msg == null || res.data.msg == ''){
								title = '操作失败';
							} 
							that.commonContent = title;
							that.$refs.commonDialog.open();
							return;
						}
						
					},							
				})
			},
			
			
			editDetialNew(){
				var that = this;
				that.isShow =  true;
				var receiptNot = "";
				if(that.title.includes("产成品入库")){
					receiptNot = "WmProductRecpt";
				}else if(that.title.includes("杂收")){
					receiptNot = "WmMiscRcvTrans";
				}else if(that.title.includes("调入")){
					receiptNot = "WmTransferIn";
				}else if(that.title.includes("返工")){
					receiptNot = "rework";
				}
				uni.request({
					url:that.baseUrl+'/system/recpt/editState',
					data:{
						productList:that.productList,
						areaCode : that.warehouseLocation,
						recptId:that.pkOrder,
						orgId:that.orgId,
						userName:that.userName,
						receiptNot:receiptNot,
						id:that.id,
						executor:that.userName,
						startTime:'',
						endTime: new Date().toISOString().slice(0, 10),
						status:'3'
					},
					method: 'POST',
					header:{
						'authorization':  getToken()
					},
					dataType:'json',
					success: (res) =>{
						if(res.data.code == '200' || res.data.code == 200) {
							that.isShow= false
							//隐藏加载框
							uni.hideLoading();
							uni.showToast({
								title: '上架成功并且代办任务已完成',
								icon: 'none',
								duration: 3000
							});
							setTimeout(function(){
								let pages = getCurrentPages();  //获取所有页面栈实例列表
								let nowPage = pages[ pages.length - 1];  //当前页页面实例
								let prevPage = pages[ pages.length - 2 ];  //上一页页面实例
								prevPage.$vm.chooseTab(that.index);	
								uni.navigateBack({  //uni.navigateTo跳转的返回，默认1为返回上一级
									delta: 1
								});
							},1000);
						}else{
							//隐藏加载框
							uni.hideLoading();
							var msg = res.data.msg;
							if(msg == null || msg == ""){
								msg = "操作失败";
							}
							that.isShow= false
							that.commonContent = msg;
							that.$refs.commonDialog.open();
							return;
						}
						
					},							
				})
			},
			
			//更新代办任务状态为完成
			updateTask(){
				var that = this;
				uni.request({
					url:that.baseUrl+'/system/wmsbacklog/update',
					data:{
						id:	that.id,
						executor:that.userName,
						orgId:that.orgId,
						startTime:'',
						endTime: new Date().toISOString().slice(0, 10),
						status:'3'//完成状态
					},
					method: 'POST',
					header:{
						'authorization':  getToken()
					},
					dataType:'json',
					success: (res) =>{
						//隐藏加载框
						uni.hideLoading();
						if(res.data.code == '200' || res.data.code == 200) {	
							uni.showToast({
								title: '上架成功并且代办任务已完成',
								icon: 'none',
								duration: 3000
							});		
							//that.unregisterScan();
							//player.stop();
							setTimeout(function(){
								let pages = getCurrentPages();  //获取所有页面栈实例列表
								let nowPage = pages[ pages.length - 1];  //当前页页面实例
								let prevPage = pages[ pages.length - 2 ];  //上一页页面实例
								prevPage.$vm.chooseTab(that.index);	
								uni.navigateBack({  //uni.navigateTo跳转的返回，默认1为返回上一级
									delta: 1
								});
							},1000);							
						}else{
							var title = res.data.msg;
							if(res.data.msg == null || res.data.msg == ''){
								title = '操作失败';
							} 
							that.commonContent = title;
							that.$refs.commonDialog.open();
							return;
						}
						
					},			
				})
			},
			
			dialogClose(){
				this.trojanCode = '';
				this.warehouseLocation = '';
				this.$refs.alertDialog.close();
			},
			
			messageClose(){
				this.boxCode = '';
				this.warehouseLocation = '';
				this.$refs.messageDialog.close();
			},
			
			tipConfirm(){
				//显示加载框
				uni.showLoading({
					title: '加载中',
					mask:true
				});
				var that = this;
				that.$refs.tipDialog.close();
				var lineId = "";
				for(var i=0;i<that.productList.length;i++){
					var childList = that.productList[i].childList;
					for(var j=0;j<childList.length;j++){
						var data = childList[j];
						if(data.attr10  ==  that.boxCode){
							lineId = data.lineId;
						}
					}
				}
				var receiptNot = "";
				if(that.title.includes("产成品入库")){
					receiptNot = "WmProductRecpt";
				}else if(that.title.includes("杂收")){
					receiptNot = "WmMiscRcvTrans";
				}else if(that.title.includes("调入")){
					receiptNot = "WmTransferIn";
				}else if(that.title.includes("返工")){
					receiptNot = "rework";
				}
				uni.request({
					url:that.baseUrl+'/system/area/editPut',
					data:{
						boxCode:that.boxCode,
						lineId : lineId,
						areaCode : that.warehouseLocation,
						userName:that.userName,
						orgId:that.orgId,
						receiptNot:receiptNot
					},
					method: 'POST',
					header:{
						'authorization':  getToken()
					},
					dataType:'json',
					success: (res) =>{
						//隐藏加载框
						uni.hideLoading();
						if(res.data.code == '200' || res.data.code == 200) {									
							//that.$refs.messageDialog.close();
							that.prompt();
							that.queryData(that.pkOrder,that.url);
							that.boxCode = '';
							//that.warehouseLocation = '';
						}else{
							var title = res.data.msg;
							if(res.data.msg == null || res.data.msg == ''){
								title = '操作失败';
							} 
							that.commonContent = title;
							that.$refs.commonDialog.open();
							return;
						}
						
					},							
				})
			},
			
			tipClose(){
				this.$refs.tipDialog.close();
			},
			
			prompt(type){
				var innerAudioContext = uni.createInnerAudioContext();
				innerAudioContext.autoplay = true;
				innerAudioContext.src = '/static/mp3/success.mp3';
				//innerAudioContext.play();//铃声文件的路径
				//innerAudioContext.stop();
				innerAudioContext.onPlay(() => {
				  console.log('开始播放');
				});
				innerAudioContext.onError((res) => {
				  console.log(res.errMsg);
				  console.log(res.errCode);
				});
				innerAudioContext.onPause(function() {  
					console.log('end');  
					innerAudioContext.destroy()  
				})  
				// if(type=='vibrate')
				// {
				// 	//震动
				// 	plus.device.vibrate(500);
				// }
				// else
				// {
				// 	//声音
				// 	if(player == null){
				// 		player = MediaPlayer.create(mainVoice, uri);
				// 	}else{
				// 		player.stop();
				// 		player.release();
				// 		player = MediaPlayer.create(mainVoice, uri);
				// 	}
				// 	player.setLooping(false);
				// 	player.prepare();
				// 	player.start();			
				// }
					
			},
			
			commonConfirm(){
				this.commonContent = "";
				this.$refs.commonDialog.close();
			},
			
			commonClose(){
				this.commonContent = "";
				this.$refs.commonDialog.close();
			}
		}
	}
</script>

<style lang="scss">
	.main {
		background-color: #fff;
		height: 300upx;
		align-items: center;
		margin-top: 10upx;
	}
	.text-content {
		font-size: 48rpx;
		text-align: center;
	}
	
	.city {
		/* #ifndef APP-PLUS-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: flex-start;
		// width: 160rpx;
		margin-left: 4px;
		font-size: 26rpx;
	}
	
	.input-view {
		display: flex;
		flex-direction: row;
		flex: 1;
		//background-color: #f8f8f8;
		height: 30px;
		padding: 0 80px;
		flex-wrap: nowrap;
		margin: 7px 0;
		line-height:30px;
		font-size: 26rpx;
	}
	page {
		width: 100%;
		height: 100%;
	}
	
	
	.scrool-page {
		display: flex;
		flex-direction: column;
		width: 100%;
		height: 100%;
	}
	
	.header-cont {
		width: 100%;
		height: 110rpx;
		line-height: 100rpx;
		text-align: center;
		// background: red;
	}
	
	.list-cont {
		flex: 1;
		position: relative;
	
		.scrool-more {
			position: absolute;
			left: 0;
			right: 0;
			top: 0;
			bottom: 0;
		}
	
		.list {
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			background: #e0e0e0;
	
		}
	}
	
	
	.footer {
		color: #fff;
		line-height: 100rpx;
		flex: 0 0 100rpx;
		/* 不放大不缩小固定100rpx */
	}
</style>